// 出差申请列表
var oabtColumns = [{
  id: 'gpro',
  title: '出差单号',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'ftime',
  title: '开始时间',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'etime',
  title: '结束时间',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'address',
  title: '总计时长',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'dprc',
  title: '预测总费用',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'dpact',
  title: '申请说明',
  type: 'string',
  columnClass: 'text-left',
},  {
  id: 'afrName',
  title: '申请人',
  type: 'string',
  width: 80,
  columnClass: 'text-center',
},{
  id: 'afrTime',
  title: '申请时间',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="toDo(' + record.id + ',' + record.doType + ');"><i class="fa fa-edit"></i>  查看办理</button>';
    return content;
  }
}];
var oabtOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '出差申请列表',
  datas: [{
    id: 1,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '出差申请已提交，关联项目负责人审批的操作',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 47,
  }, {
    id: 2,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '出差申请已提交，领导审批结果：被退回',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 48,
  },{
    id: 3,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '审批通过后对应计划的工作结果填写操作',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 49,
  },{
    id: 4,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '工作结果已提交，关联项目负责人审批的操作',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 50,
  },{
    id: 5,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '工作结果审批结果：被退回',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 51,
  }, {
    id: 6,
    gpro: 'NJ20180101182988',
    ftime: '2018/01/02 08:00',
    etime: '2018/02/01 12:00',
    address: '5天3小时',
    dprc:'￥99999.00元',
    dpact: '工作结果审批通过结果页',
    afrName: '张三测试',
    afrTime: '2018-01-01',
    doType: 52,
  }, ],
  columns: oabtColumns,
  gridContainer: 'oabtContainer',
  toolbarContainer: 'oabtToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var oabtGrid = $.fn.dlshouwen.grid.init(oabtOption);
$(function () {
  oabtGrid.load();
});

// 出差流程处理跳转
function toDo(id, doType) {
  if (doType == 47) {
    window.location.href = "../../do/edit/edit-do-47.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 48) {
    window.location.href = "../../do/edit/edit-do-48.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 49) {
    window.location.href = "../../do/edit/edit-do-49.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 50) {
    window.location.href = "../../do/edit/edit-do-50.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 51) {
    window.location.href = "../../do/edit/edit-do-51.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 52) {
    window.location.href = "../../do/edit/edit-do-52.html" + '?id=' + id + '&doType=' + doType;
  }
}